<template>
  <div id="issueApplyInfoDiv">
    <el-divider content-position="left">基本信息</el-divider>
    <el-descriptions class="margin-top" :column="3" border contentClassName="contentStyle" labelClassName="labelWidth">
      <el-descriptions-item label="问题分类">{{!isEmpty(sltIssueApply)?sltIssueApply.value.issueClassifyName:''}}</el-descriptions-item>
      <el-descriptions-item label="问题类型">{{!isEmpty(sltIssueApply)?sltIssueApply.value.issueTypeName:''}}</el-descriptions-item>
      <el-descriptions-item label="客户名称">{{!isEmpty(sltIssueApply)?sltIssueApply.value.customerName:''}}</el-descriptions-item>
      <el-descriptions-item label="联系人">{{!isEmpty(sltIssueApply)?sltIssueApply.value.contactorName:''}}</el-descriptions-item>
      <el-descriptions-item label="联系电话">{{!isEmpty(sltIssueApply)?sltIssueApply.value.contactorTel:''}}</el-descriptions-item>
      <el-descriptions-item label="项目经理">{{!isEmpty(sltIssueApply)?sltIssueApply.value.projectManagerName:''}}</el-descriptions-item>
      <el-descriptions-item label="期望完成时间">{{!isEmpty(sltIssueApply)?sltIssueApply.value.expectFinishTime:''}}</el-descriptions-item>
      <el-descriptions-item label="严重程度">{{!isEmpty(sltIssueApply)?sltIssueApply.value.severity:''}}</el-descriptions-item>
      <el-descriptions-item label="优先级">{{!isEmpty(sltIssueApply)?sltIssueApply.value.priority:''}}</el-descriptions-item>
      <el-descriptions-item label="问题来源">{{!isEmpty(sltIssueApply)?sltIssueApply.value.issueSource:''}}</el-descriptions-item>
      <el-descriptions-item label="分派人" :span="2">{{!isEmpty(sltIssueApply)?sltIssueApply.value.assignId:''}}</el-descriptions-item>
      <el-descriptions-item label="问题标题" :span="3">{{!isEmpty(sltIssueApply)?sltIssueApply.value.title:''}}</el-descriptions-item>
      <el-descriptions-item label="问题描述" :span="3">
        <div v-html="!isEmpty(sltIssueApply)?sltIssueApply.value.description:''"></div>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<script setup lang="ts">
// 引入组件区 ==========
import { ref, reactive, getCurrentInstance } from 'vue';
import { VxeMessage, VxeNotifyType } from '@/utils/CommonMessage'; //提示
import { AppStore } from '@/stores/store';
import { isEmpty } from 'lodash';

let store = AppStore();
let { proxy }: any = getCurrentInstance();
let userList: any = reactive([]);
let issueSeverityList: any = reactive([]); //选择字典
let issuePriorityList: any = reactive([]);
let sltIssueApply: any = ref({});

defineExpose({ initPage });
function initPage(row: any) {
  getDictItemsList(); //批量获取字典
  getUserOptions();
  sltIssueApply.value = row;
}

async function getDictItemsList() {
  let dictTreeTypeCodes: any = ['issueSeverity', 'issuePriority'];
  const codes = dictTreeTypeCodes.join(',');
  const url = '/api/sys/basDictDetail/findDictDetailListByDictCodes';
  const dictTreeTypeItems: any = await proxy.$http.get(url, { params: { code: codes } });
  const severityType = dictTreeTypeItems.data.find((item) => item.code === 'issueSeverity');
  issueSeverityList.push(...severityType.detailDataList);

  const priorityType = dictTreeTypeItems.data.find((item) => item.code === 'issuePriority');
  issuePriorityList.push(...priorityType.detailDataList);
}

function getUserOptions() {
  const url = '/api/user/getUserInfoList';
  proxy.$http
    .get(url, {})
    .then((res: any) => {
      userList.push(...res.data);
      // console.log('获取所有可用用户', userOptions);
    })
    .catch((err: any) => {
      VxeMessage('获取所有用户选项 (下拉框)失败', VxeNotifyType.error);
    });
}
</script>

<style lang="scss" scoped>
#issueApplyInfoDiv {
}
</style>